package cn.smbms.biz.impl;

import java.util.List;


import cn.smbms.biz.UserBiz;
import cn.smbms.dao.UserMapper;
import cn.smbms.entity.User;

public class UserBizImpl implements UserBiz {
	private UserMapper userMapper;

	public void setUserMapper(UserMapper userMapper) {
		this.userMapper = userMapper;
	}

	@Override
	public int add(User user) {
		return this.userMapper.add(user);
		
	}

	@Override
	public User getLoginUser(String userCode, String userPassword) {
		return this.userMapper.getLoginUser(userCode, userPassword);
	}

	@Override
	public List<User> getUserList(String userName, Integer userRole, Integer currentPageNo, Integer pageSize) {
		try {
			return this.userMapper.getUserList(userName, userRole, (currentPageNo-1)*pageSize, pageSize);
			
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
		
	}
	

	@Override
	public int getUserCount(String userName, Integer userRole) {
		return this.userMapper.getUserCount(userName, userRole);
	}

	@Override
	public int deleteUserById(Integer delId) {
		return this.userMapper.deleteUserById(delId);
	}

	@Override
	public User getUserById(Integer id) {
		return this.userMapper.getUserById(id);
	}

	@Override
	public int modify(User user) {
		return this.userMapper.modify(user);
	}

	@Override
	public int updatePwd(int id, String pwd) {
		return this.userMapper.updatePwd(id, pwd);
	}

	@Override
	public User getUserCode(String userCode) {
		
		return this.userMapper.getUserCode(userCode);
	}

}
